{{append . "moreStyles" "css/admin/admin-post.css"}} 
{{append . "moreStyles" "third/mdeditor/css/editormd.min.css"}} 
{{append . "moreStyles" "third/magicsuggest/magicsuggest.css"}} 
{{append . "moreScripts" "third/mdeditor/editormd.min.js"}} 
{{append . "moreScripts" "third/magicsuggest/magicsuggest.js"}} 
{{append . "moreScripts" "js/admin/admin-post.js"}} 
{{set . "_title" "撰写文章"}} 
{{template "Layout/AdminHeader.html" .}}

<div class="main admin-user admin-post">
    <h2 class="page-header title">{{._title}}</h2> <span class="add"></span>
    <div>
        <div class="edit-area">
            <div class="editor">
                <div class="form-group">
                    <input type="text" id="blog-title" class="form-control" placeholder="标题" 
                    {{with .blog}} value="{{.Title}}" {{end}}>
                </div>
                <div>
                    {{template "Admin/Post/editor-md.html" .}}
                </div>
                <div style="display: none">
                    <textarea name="" id="blog-src" cols="30" rows="10">{{with .blog}}{{.ContentMD}}{{end}}</textarea>
                </div>
                <div class="">
                    <label for="">摘要</label>
                    <textarea id="blog-summary" class="form-control" cols="30" rows="3" placeholder="请输入摘要">{{with .blog}}{{.Summary}}{{end}}</textarea>
                </div>
            </div>
            <div class="extra">
                <div class="form-group">
                    <label for="">URL 标识</label>
                    <input id="blog-ident" type="text" class="form-control" 
                    {{with .blog}} value="{{.Ident}}"{{end}}>
                </div>
                <div class="form-group">
                    <label for="">发布时间</label>
                    <input id="blog-createtime" type="text" class="form-control"
                       value="{{date .createtime}}">
                </div>
                <div class="form-group">
                    <label for="">分类</label>
                    <div class="category-list">
                        {{range .categorys}}
                        <li>
                            <input type="radio" id="category-{{.Id}}" name="category" value="{{.Id}}"
                               {{if eq $.blog.CategoryId .Id}} checked="checked" {{end}}>
                            <label for="category-{{.Id}}">{{.Name}}</label>
                        </li>
                        {{end}}
                    </div>
                </div>

                <div class="form-group tag">
                    <label for="">标签</label>
                    <select id="magicsuggest">
                        {{range .tags}}
                        <option value="{{.Id}}">{{.Name}}</option>
                        {{end}}  
                    </select>
                </div>
            </div>
            <div style="display:none">
                <input id="blog-id" type="hidden" {{with .blog}} value="{{.Id}}" {{else}} value="0" {{end}}>
                <div id="blog-tags">{{with .blog}}{{.BlogTagsJSON}}{{end}}</div>
            </div>
        </div>
    </div>

    <div class="buttons">
        <button class="btn btn-default btn-sm">保存草稿</button>
        <button class="btn btn-primary btn-sm" onclick="Post.submit()">提交</button>
    </div>
</div>

{{template "Layout/AdminFooter.html" .}}